package pl.edu.agh.sius.gui;

import java.awt.Component;

import javax.swing.JTabbedPane;

public class MainJTabbedPane extends JTabbedPane{
	private static final long serialVersionUID = -1527651262363673008L;
	
	Component downloadJPanel;
	Component uploadJPanel;
	Component loginJPanel;
	Component signUpJPanel;

	public static String user;
	public static String localServerAddress;
	
	public void init(){
		addTab("Login", loginJPanel);
		addTab("Sign Up", signUpJPanel);
        addTab("Downloads", downloadJPanel);
        addTab("Uploads", uploadJPanel);
        setEnabledAt(2, false);
        setEnabledAt(3, false);
	}
	
	public void userLoggedIn(String login) {
		user = login;
		setEnabledAt(0, false);
		setEnabledAt(1, false);
		setEnabledAt(2, true);
		setEnabledAt(3, true);
		setSelectedIndex(2);
		((DownloadJPanel)downloadJPanel).refresh();
		((UploadJPanel)uploadJPanel).setFilesData();
	}

	public Component getDownloadJPanel() {
		return downloadJPanel;
	}

	public void setDownloadJPanel(Component downloadJPanel) {
		this.downloadJPanel = downloadJPanel;
	}

	public Component getUploadJPanel() {
		return uploadJPanel;
	}

	public void setUploadJPanel(Component uploadJPanel) {
		this.uploadJPanel = uploadJPanel;
	}

	public Component getLoginJPanel() {
		return loginJPanel;
	}

	public void setLoginJPanel(Component loginJPanel) {
		this.loginJPanel = loginJPanel;
	}

	public Component getSignUpJPanel() {
		return signUpJPanel;
	}

	public void setSignUpJPanel(Component signUpJPanel) {
		this.signUpJPanel = signUpJPanel;
	}

	public String getLocalServerAddress() {
		return localServerAddress;
	}

	public void setLocalServerAddress(String localServerAddress) {
		MainJTabbedPane.localServerAddress = localServerAddress;
	}
	
	

}
